analysis_random_graphs
performs the steps needed for doing typical
graph theory analyses with brain MRI data if you need to generate equivalent
random graphs. This includes calculating small world parameters and
normalized rich club coefficients.
sim.rand.graph.par
simulates N
simple random graphs with the
same clustering (optional) and degree sequence as the input. Essentially a
wrapper for sample_degseq
(or, if you want to match by
clustering, sim.rand.graph.clust
) and
make_brainGraph
. It uses foreach
for
parallel processing.
sim.rand.graph.clust
simulates a random graph with a given degree
sequence and clustering coefficient. Increasing the max.iters
value will result in a closer match of clustering with the observed graph.
sim.rand.graph.hqs
generates a number of random covariance matrices
using the Hirschberger-Qi-Steuer (HQS) algorithm, and create graphs from
those matrices.
analysis_random_graphs(g.list, level = g.list[[1L]]$level, N = 100L,
savedir = ".", ...)sim.rand.graph.par(g, level = c("subject", "group"), N = 100L,
clustering = FALSE, rewire.iters = max(10 * ecount(g), 10000L),
cl = g$transitivity, max.iters = 100L, ...)
sim.rand.graph.clust(g, rewire.iters = 10000, cl = g$transitivity,
max.iters = 100)
sim.rand.graph.hqs(resids, level = c("subject", "group"), N = 100L,
weighted = TRUE, r.thresh = NULL, ...)
analysis_random_graphs
returns a list containing:
A data table containing normalized rich-club coefficients and p-values
A data table with small-world parameters
A data table with some global graph measures for all random graphs generated
sim.rand.graph.par
- a list of N random graphs
with some additional vertex and graph attributes
sim.rand.graph.clust
- A single igraph
graph object
sim.rand.graph.hqs
- A list of random graphs from the null
covariance matrices
List of brainGraphList
objects; the length of this list
should equal the number of thresholds/densities in the study
Character string indicating whether the graphs are subject-,
group-, or contrast-specific. Default: 'subject'
Integer; the number of random graphs to simulate. Default: 100
Character string specifying the directory in which to save the generated graphs. Default: current working directory
Other arguments passed to make_brainGraph
A graph object
Logical; whether or not to control for clustering. Default:
FALSE
Integer; number of rewiring iterations for the initial graph randomization. Default: 1e4
The clustering measure. Default: transitivity
The maximum number of iterations to perform; choosing a lower number may result in clustering that is further away from the observed graph's. Default: 100
A brainGraph_resids
object, a data.table
of
residuals, or a numeric matrix
Logical indicating whether to create weighted graphs. If true, a threshold must be provided.
Numeric value for the correlation threshold, if
weighted=FALSE
.
Christopher G. Watson, cgwatson@bu.edu
analysis_random_graphs
does the following:
Generate N
random graphs for each graph and density/threshold
Write graphs to disk in savedir
. Read them back into R
and combine into lists; then write these lists to disk. You can later
delete the individual .rds
files afterwards.
Calculate small world parameters, along with values for a few global graph measures that may be of interest.
Calculate normalized rich club coefficients and associated p-values.
If you do not want to match by clustering, then simple rewiring of the input
graph is performed (the number of rewires equaling the larger of 1e4
and \(10 \times m\), where \(m\) is the graph's edge count).
sim.rand.graph.hqs
- The first step is to create the observed
covariance of residuals (or whatever matrix/data.table is provided). Then
random covariance matrices are created with the same distributional
properties as the observed matrix, they are converted to correlation
matrices, and finally graphs from these matrices. By default, weighted graphs
will be created in which the edge weights represent correlation values. If
you want binary matrices, you must provide a correlation threshold.
Bansal, S. and Khandelwal, S. and Meyers, L.A. (2009) Exploring biological network structure with clustered random networks. BMC Bioinformatics, 10, 405--421. tools:::Rd_expr_doi("10.1186/1471-2105-10-405")
Hirschberger M., Qi Y., Steuer R.E. (2007) Randomly generating portfolio-selection covariance matrices with specified distributional characteristics. European Journal of Operational Research. 177, 1610--1625. tools:::Rd_expr_doi("10.1016/j.ejor.2005.10.014")
if (FALSE) {
rand_all <- analysis_random_graphs(g.norm, 1e2,
savedir='/home/cwatson/dti/rand', clustering=F)
}
if (FALSE) {
rand1 <- sim.rand.graph.par(g[[1]][[N]], N=1e3)
rand1.cl <- sim.rand.graph.par(g[[1]][[N]], N=1e2,
clustering=T, max.iters=1e3)
}
Run the code above in your browser using DataLab